public class Main {

    public static void main(String[] args) {
        arrayStack();
    }


    public static void arrayMy() {

        ArrayMy<Integer> arr = new ArrayMy<Integer>();
        for (int i = 0; i < 10; i++) {
            System.out.println(i + "\n");
            arr.addLast(i);
        }
        System.out.println(arr);

        arr.add(1, -1);
        System.out.println(arr);


        //测试减少后resize/2
//        for (int i = 0; i <3 ; i++) {
        arr.removeFirst();
        arr.removeLast();
        arr.removeLast();
        arr.removeLast();
        arr.addFirst(1);
        arr.addFirst(1);
        arr.addFirst(1);
        arr.addFirst(1);
        arr.addFirst(1);
        arr.addFirst(1);
        arr.addFirst(1);
        arr.addFirst(1);
//        }
        System.out.println(arr);
        System.out.println("删除第二次\n");
        System.out.printf("size is%s,capacity is %s", arr.getSize(), arr.getCapacity());
        arr.removeFirst();
        System.out.println(arr);
        arr.addFirst(-1);
        System.out.println(arr);
        // [-1, 0, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9]

        arr.del(2);
        System.out.println(arr);

        arr.removeElement(4);
        System.out.println(arr);

        arr.removeFirst();
        System.out.println(arr);
    }

    public static void stu() {
        ArrayMy<Student> arr = new ArrayMy<>();

        arr.add(0, new Student("张三", 100));
        arr.add(0, new Student("李四", 90));
        arr.add(0, new Student("王五", 80));

        System.out.println(arr);
    }

    public static void arrayStack() {

        ArrayStack<Integer> arrayStack = new ArrayStack<>();

        for (int i = 10; i < 15; i++) {
            arrayStack.push(i);
            System.out.println(arrayStack);
        }
        arrayStack.push(123);
        System.out.println(arrayStack);
    }

}
